package kz.pompei.oneGwtStands.client.simpleadapters;

import kz.pompei.OneGwt.ifaces.widget.StateMessage;
import kz.pompei.OneGwt.ifaces.widget.gwtadapters.ListBox_impl_ListWidget;

import com.google.gwt.user.client.ui.ListBox;

public class TestRecordList extends ListBox_impl_ListWidget<TestRecord> {
  public TestRecordList(ListBox widget) {
    super( widget );
  }
  
  @Override
  protected String extractId(TestRecord record) {
    if (record == null) return null;
    return record.getId();
  }
  
  @Override
  protected String extractDisplayStr(TestRecord record) {
    if (record == null) return null;
    return record.getFio() + " (age: " + record.getAge() + ", id: " + record.getId() + ")";
  }
  
  @Override
  protected String whatStateMessageText(StateMessage stateMessage) {
    if (stateMessage == StateMessage.USER1) {
      return "Это пользовательское сообщение";
    }
    return super.whatStateMessageText( stateMessage );
  }
}
